import request from '@/config/axios'

export interface WeCustomerVO {
  id: number
  parentId: number
  name: string
  avatar: string
  corpName: string
  corpFullName: string
  positionName: string
  type: number
  gender: number
  unionId: string
  externalUserId: string
}

// 查询企微客户列表
export const getWeCustomerPage = async (params) => {
  return await request.get({ url: `/wecom/we-customer/page`, params })
}
// 查询企微客户列表
export const getWeCustomerSimpleList = async (params) => {
  return await request.get({ url: `/wecom/we-customer/simple-list`, params })
}

// 查询企微客户详情
export const getWeCustomer = async (id: number) => {
  return await request.get({ url: `/wecom/we-customer/get?id=` + id })
}
// weCustomerId查询企微客户详情
export const getWeCustomerId = async (id) => {
  return await request.get({ url: `/wecom/we-customer/get-by-we-customer-id?weCustomerId=` + id })
}

// 新增企微客户
export const createWeCustomer = async (data: WeCustomerVO) => {
  return await request.post({ url: `/wecom/we-customer/create`, data })
}

// 修改企微客户
export const updateWeCustomer = async (data: WeCustomerVO) => {
  return await request.put({ url: `/wecom/we-customer/update`, data })
}

// 删除企微客户
export const deleteWeCustomer = async (id: number) => {
  return await request.delete({ url: `/wecom/we-customer/delete?id=` + id })
}

// 导出企微客户 Excel
export const exportWeCustomer = async (params) => {
  return await request.download({ url: `/wecom/we-customer/export-excel`, params })
}

// 同步企微员工
export const syncUser = async () => {
  return await request.post({ url: `/wecom/we-customer/sync-customer` })
}
// 根据客户获取跟进人列表
export const getUserListByCustomer = async (params) => {
  return await request.get({ url: `/wecom/we-cus-follow-user/get-user-list-by-customer`, params })
}

// 获取客户标签
export const getCustomerTag = async (params) => {
  return await request.get({ url: `/wecom/we-cus-follow-tag/list-by-customer`, params })
}
// 修改客户标签
export const editCustomerTag = async (data) => {
  return await request.post({ url: `/wecom/we-customer/edit-customer-tag`, data })
}
// 企业微信客户转crm客户绑定
export const bindCustomerApi = async (data) => {
  return await request.post({ url: `/wecom/we-customer/bind-customer`, data })
}
